The PointerWatcher passes the current pointer position to every watch,
so we don't have to query the pointer again scrollToMousePos() is used
as watch callback.
While that should be the only use, be conservative and still query the
pointer when called without arguments.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1932>
* system pointer.
* @returns {bool} true.
*/
- scrollToMousePos() {
- let [xMouse, yMouse] = global.get_pointer();
+ scrollToMousePos(...args) {
+ const [xMouse, yMouse] = args.length ? args : global.get_pointer();
if (xMouse != this.xMouse || yMouse != this.yMouse) {
this.xMouse = xMouse;